package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "indent_details_outbound_", schema = "jinsanjiao", catalog = "")
public class IndentDetailsOutbound {
    private int indentDetailsNumber;
    private Long indentDetailsQuantity;
    private Drug drugByDrugId;
    private Purchase purchaseByPurchaseId;

    @Id
    @Column(name = "indent_details_number", nullable = false)
    public int getIndentDetailsNumber() {
        return indentDetailsNumber;
    }

    public void setIndentDetailsNumber(int indentDetailsNumber) {
        this.indentDetailsNumber = indentDetailsNumber;
    }

    @Basic
    @Column(name = "indent_details_quantity", nullable = true, precision = 0)
    public Long getIndentDetailsQuantity() {
        return indentDetailsQuantity;
    }

    public void setIndentDetailsQuantity(Long indentDetailsQuantity) {
        this.indentDetailsQuantity = indentDetailsQuantity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        IndentDetailsOutbound that = (IndentDetailsOutbound) o;
        return indentDetailsNumber == that.indentDetailsNumber &&
                Objects.equals(indentDetailsQuantity, that.indentDetailsQuantity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(indentDetailsNumber, indentDetailsQuantity);
    }

    @ManyToOne
    @JoinColumn(name = "drug_id", referencedColumnName = "drug_id")
    public Drug getDrugByDrugId() {
        return drugByDrugId;
    }

    public void setDrugByDrugId(Drug drugByDrugId) {
        this.drugByDrugId = drugByDrugId;
    }

    @ManyToOne
    @JoinColumn(name = "purchase_id", referencedColumnName = "purchase_id")
    public Purchase getPurchaseByPurchaseId() {
        return purchaseByPurchaseId;
    }

    public void setPurchaseByPurchaseId(Purchase purchaseByPurchaseId) {
        this.purchaseByPurchaseId = purchaseByPurchaseId;
    }
}
